﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using diploma.core;
using diploma.core.localize;
using diploma.core.GUI;
using diploma.test.GUI;
using diploma.editor;
using diploma.core.localize.lang;

namespace diploma
{
    public partial class MainForm : Form, ILocalizable
    {
        AbstractLocalizator _appLocalizator;

        List<DiplomaForm> _items;
        public MainForm()
        {
            InitializeComponent();
            _appLocalizator = ApplicationLocalizatior.Instance;
            _appLocalizator.ChangeDictionary(LocalizeFactory.createDictionary(Languages.Ukrainian));
            
            Loading();
        }

        private void LocalizeMenu(ToolStripMenuItem item)
        {
            item.Text = _appLocalizator.GetLocolizeWord(item.Text);
            foreach (ToolStripItem subitem in item.DropDownItems)
            {
                if (subitem is ToolStripMenuItem)
                {
                    LocalizeMenu(subitem as ToolStripMenuItem);
                }
            }

        }

        #region ILocalizable Members

        public void Localize()
        {
            this.Text = _appLocalizator.GetLocolizeWord(this.Text);
            foreach (ToolStripMenuItem item in msMain.Items)
            {
                LocalizeMenu(item);
            }

        }

        #endregion

        private void menufileexitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
